<?php

namespace App\Model\Roles;

use App\Model\Base as Model;

class Permission extends Model
{
    protected $guarded = [];//不可以注入的字段

    public function setPermission($user_id, $permission)
    {
        $params['user_id'] = $user_id;
        $params['permission'] = $permission;
        $this->create($params);
    }

    public function getUserPermission($user_id)
    {
        return $this->where('id', $user_id)->select('permission')->first();
    }
}
